﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;

namespace RIS.TMP.WEB.APP.Models
{
    [Table("MRestoreToAdmin")]
    public class MRestoreToAdmin
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int ResId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ForeignKey("CAddCar")]
        [Required(ErrorMessage = "กรุณาเลิอกทะเบียนรถ", AllowEmptyStrings = false)]
        public int AddCarId { get; set; }
        [ForeignKey("CCheckPlan")]
        [Required(ErrorMessage = "กรุณาเลิอกเช็คระยะตามแผน", AllowEmptyStrings = false)]
        public int CCheckPlanId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "กรุณาลักษณะของการซ่อม", AllowEmptyStrings = false)]
        public Nullable<int> StatusRes { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "กรุณาเลิอกวันที่แจ้งซ่อม", AllowEmptyStrings = false)]
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        [DataType(DataType.Date)]
        public Nullable<System.DateTime> ResDate { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        [DataType(DataType.Date)]
        public Nullable<System.DateTime> SentToDatePair { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "กรุณาเลิอกรหัสใบแจ้งซ่อม", AllowEmptyStrings = false)]
        [Display(Name = "รหัสใบแจ้งซ่อม")]
        public string ResCode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Nullable<int> MileNo { get; set; }
        /// <summary>
        /// แผนซ่อมบำรุง
        /// </summary>
        public Nullable<int> PlanProject { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "กรุณาเลือกรายการแจ้งซ่อม", AllowEmptyStrings = false)]
        [ForeignKey("CCategoryRepair")]
        public Nullable<int> CReId { get; set; }
        public Nullable<int> Facstatus { get; set; }
        public Nullable<int> MRestore { get; set; }
        public Nullable<int> ApproveNo { get; set; }
        public string Remarks { get; set; }
        public string RecordStatus { get; set; }
        public string CreateBy { get; set; }
        public Nullable<System.DateTime> CreateWhen { get; set; }
        public string UpdateBy { get; set; }
        public Nullable<System.DateTime> UpdateWhen { get; set; }

        public virtual CAddCar CAddCar { get; set; }
        public virtual CCategoryRepair CCategoryRepair { get; set; }
        public virtual CCheckPlan CCheckPlan { get; set; }
    }
}